package cn.iocoder.yudao.module.jky.dal.mysql.goodscat;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.jky.dal.dataobject.goodscat.GoodsCatDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.jky.controller.admin.goodscat.vo.*;

/**
 * 商品分类 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface GoodsCatMapper extends BaseMapperX<GoodsCatDO> {

    default PageResult<GoodsCatDO> selectPage(GoodsCatPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GoodsCatDO>()
                .likeIfPresent(GoodsCatDO::getCatName, reqVO.getCatName())
                .inIfPresent(GoodsCatDO::getCatId,reqVO.getCatIdList())
                .orderByDesc(GoodsCatDO::getSort));
    }

    default List<GoodsCatDO> selectList(GoodsCatExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<GoodsCatDO>()
                .likeIfPresent(GoodsCatDO::getCatName, reqVO.getCatName())
                .eqIfPresent(GoodsCatDO::getKeywords, reqVO.getKeywords())
                .eqIfPresent(GoodsCatDO::getDescription, reqVO.getDescription())
                .eqIfPresent(GoodsCatDO::getContent, reqVO.getContent())
                .eqIfPresent(GoodsCatDO::getIsShow, reqVO.getIsShow())
                .eqIfPresent(GoodsCatDO::getParentId, reqVO.getParentId())
                .eqIfPresent(GoodsCatDO::getIsTop, reqVO.getIsTop())
                .eqIfPresent(GoodsCatDO::getType, reqVO.getType())
                .orderByDesc(GoodsCatDO::getSort));
    }

}
